Skip to content

Optimize generated Lua table access in hot loops - #1297

Merged
Frotty merged 2 commits into
masterfrom
codex/lua-localize-hot-storage
Sep 4, 2026
Merged

Optimize generated Lua table access in hot loops#1297
Frotty merged 2 commits into
masterfrom
codex/lua-localize-hot-storage

Conversation

@Frotty

@Frotty Frotty commented Sep 4, 2026

Copy link
Copy Markdown
Member

Summary

  • cache compiler-owned global array and class-field storage tables in Lua locals when they are indexed from loops
  • bound and deterministically rank aliases to preserve Lua register headroom and avoid the locals-table fallback
  • cover cold-path exclusion, real Lua behavior, the local-budget boundary, and the stdlib spatial-index hot loop

Testing

  • ./gradlew.bat test --tests "tests.wurstscript.tests.LuaBackendAuditTests.hotLoopStorageTablesAreLocalizedOnLua" --tests "tests.wurstscript.tests.LuaBackendAuditTests.localizedHotStorageTablesPreserveLuaBehavior" --tests "tests.wurstscript.tests.LuaBackendAuditTests.hotStorageLocalizationRespectsLuaRegisterHeadroom" --tests "tests.wurstscript.tests.LuaBackendAuditTests.optimizedUnitSpatialIndexInnerLoopUsesRawLuaOperations"
  • ./gradlew.bat test --tests "tests.wurstscript.tests.LuaTranslationTests.largeFunctionSpillsLocalsIntoTableInLua" --tests "tests.wurstscript.tests.LuaTranslationTests.spilledLocalsDeclareTableBeforeFirstUseInLua"

Full suite left to CI as requested.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 4, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-04T20:39:12.186161Z 181109f Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Frotty

Frotty commented Sep 4, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: 181109f8e6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Frotty
Frotty merged commit 0e83860 into master Sep 4, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant